<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>金币获取记录管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		
 
     $(function(){
		  //循环集合取出统计数字
		 var json='${json}';
		 var rul=eval(json);
		 var len=eval(json).length;
		 var totalUserNum=0;
		 var totalGoldNum=0;
		 var iosUser=0;
		 var iosNum=0;
		 var adUser=0;
		 var adNum=0;
		 var pcUser=0;
		 var pcNum=0;
		 var hUser=0;
		 var hNum=0;
		 for(i=0;i<len;i++){
			 if(rul[i].totalUserNum==null){
		         //1 pc 2 安卓 3 ios 4 h5
				 if(rul[i].equipment=='3'){
					 iosUser=rul[i].userNum;
					 iosNum=rul[i].goldNum;
				 }else if(rul[i].equipment=='2'){
					 adUser=rul[i].userNum;
					 adNum=rul[i].goldNum;
				 }else if(rul[i].equipment=='1'){
					 pcUser=rul[i].userNum;
					 pcNum=rul[i].goldNum;
				 }else if(rul[i].equipment=='4'){
					 hUser=rul[i].userNum;
					 hNum=rul[i].goldNum;
				 }
			 }else {
				 totalUserNum=rul[i].totalUserNum;
				 totalGoldNum=rul[i].totalGoldNum;
			 }
		 }
		 $("#t_user").html(totalUserNum);
		 $("#ios_user").html(iosUser);
		 $("#an_user").html(adUser);
		 $("#pc_user").html(pcUser);
		 $("#h5_user").html(hUser);
		 $("#t_num").html(totalGoldNum);
		 $("#ios_num").html(iosNum);
		 $("#an_num").html(adNum);
		 $("#pc_num").html(pcNum);
		 $("#h5_num").html(hNum);		 
    })	
		
		
		
		
	</script>
</head>
<body>
	
	<form:form id="searchForm" modelAttribute="goldcoinTradeRecord" action="${ctx}/goldcointraderecord/goldcoinTradeRecord/userGoldOverdueList?branchId=${branchId}" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/>
		<table>
		 <tr>
		   <td>
		       <div style="margin-left:100px;margin-top:9px">手机号码&nbsp;
		       <form:input path="mobile" htmlEscape="false" maxlength="11" class="input-medium"/>
		       </div>
	       </td>		 
		   <td> 
		        <div style="margin-left:100px;margin-top:9px;">用户id&nbsp;
				<form:input path="userid" htmlEscape="false" maxlength="8" class="input-medium"/>
				</div>
	       </td>
	       <td>
	         <div style="margin-left:30px;margin-top:9px;">每页&nbsp;
			 <select id="pageSize" name="pageSize" class="input-medium">
			    <option value="20"    <c:choose><c:when test="${page.pageSize=='20'}">selected=true</c:when></c:choose>>20</option>
				<option value="30"    <c:choose><c:when test="${page.pageSize=='30'}">selected=true</c:when></c:choose>>30</option>
				<option value="100"   <c:choose><c:when test="${page.pageSize=='100'}">selected=true</c:when></c:choose>>100</option>
				<option value="500"   <c:choose><c:when test="${page.pageSize=='500'}">selected=true</c:when></c:choose>>500</option>
				<option value="1000"  <c:choose><c:when test="${page.pageSize=='1000'}">selected=true</c:when></c:choose>>1000</option>
			</td>
			</div>
	     </tr>
			
		  <tr>
		  <td> <div style="margin-left:125px;">设备&nbsp;</label>
				<form:select path="equipment" class="input-medium">
					<option value="" label=""/>
				    <form:option value="3" label="ios"/>
				    <form:option value="2" label="安卓"/>
				    <form:option value="4" label="h5"/>
				    <form:option value="1" label="pc"/>
				</form:select>
				</div>
			</td>			
			
			<td>
			    <div style="margin-left:58px;margin-top:9px;">金币过期时间&nbsp;
				<input name="beginCreateDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${goldcoinTradeRecord.beginCreateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> - 
				 <input name="endCreateDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${goldcoinTradeRecord.endCreateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
			     </div>
			</td>
						
			<td class="btns">
			  <div style="margin-left:100px;margin-top:9px;"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></div>
			  </td>	  
			<td class="clearfix"></td>
			</tr>
		</table>	
	</form:form>
	<table>
	  <tr>累计人次<span id="t_user"></span>,其中,iOS---<span id="ios_user"></span>人,安卓---<span id="an_user"></span>人,pc---<span id="pc_user"></span>人,h5---<span id="h5_user"></span>人</tr></br>
	  <tr>总过期金币<span id="t_num"></span>,iOS---<span id="ios_num"></span>个,安卓---<span id="an_num"></span>个,pc---<span id="pc_num"></span>个,h5---<span id="h5_num"></span>个</tr>
	</table>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th	style="color:#5599FF;">用户Id</th>
				<th	style="color:#5599FF;">用户姓名</th>
				<th	style="color:#5599FF;">用户手机号码</th>				
				<th	style="color:#5599FF;">金币所属活动</th>
				<th	style="color:#5599FF;">金币获得渠道</th>
				<th	style="color:#5599FF;">金币获得设备</th>
				<th	style="color:#5599FF;">过期金币</th>
				<th style="color:#5599FF;">金币有效期限(天)</th>
				<th	style="color:#5599FF;">金币领取时间</th>
				<th	style="color:#5599FF;">金币过期时间</th>
		   </tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="goldRecord" varStatus="i">
			<tr>
			    <td>
					${goldRecord.userid}
				</td>
				<td>
					${goldRecord.userName}
				</td>
				<td>
					${goldRecord.mobile}
				</td>
				
				<td>
					${goldRecord.activityName}
				</td>
				<td>
					${goldRecord.subChannel}
				</td>
				<td>
				    <c:if test="${goldRecord.equipment ==1}">PC</c:if>
					<c:if test="${goldRecord.equipment ==2}">安卓</c:if>
					<c:if test="${goldRecord.equipment ==3}">IOS</c:if>
					<c:if test="${goldRecord.equipment ==4}">H5</c:if>
				</td>
				<td>
					${goldRecord.goldnumber}
				</td>
				<td>
					${goldRecord.goldValidityDay}
				</td>				
				<td>
					<fmt:formatDate value="${goldRecord.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
				    <fmt:formatDate value="${goldRecord.endtime}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>